package com.weimon.order.service.impl;

import java.util.List;

import com.weimob.bean.User;
import com.weimob.service.OrderService;
import com.weimob.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import com.alibaba.dubbo.config.annotation.Reference;

/**
 * 1、将服务提供者注册到注册中心（暴露服务）
 * 1）、导入dubbo依赖（2.6.2）\操作zookeeper的客户端(curator)
 * 2）、配置服务提供者
 * <p>
 * 2、让服务消费者去注册中心订阅服务提供者的服务地址
 *
 */
@Slf4j
@Service
public class OrderServiceImpl implements OrderService {

    // 直连
    @Reference(version = "1.0.0", url = "dubbo://localhost:20880")
    //@Reference(version = "2.0", stub="com.weimon.order.service.stub.UserServiceStub")
    UserService userService;

    @Override
    public List<User> initOrder(String userId) {
        log.info("boot-order-service-consumer 用户id：" + userId);
        List<User> addressList = userService.getUserAddressList(userId);
        return addressList;
    }
}
